<?php
$ext = substr($icon_path, strrpos($icon_path, '.'));
switch ($ext) {
case '.png':
    $type = 'image/png';
    break;
case '.jpg':
case '.jpeg':
    $type = 'image/jpeg';
    break;
case '.gif':
    $type = 'image/gif';
    break;
case '.ico':
    $type = 'image/ico';
    break;
case '.bmp':
    $type = 'image/bmp';
    break;
}

header("Content-Type: $type");
header("Content-Lenght: ".filesize($icon_path));

$fp = fopen($icon_path, 'rb');
fpassthru($fp);
?>
